<?php

namespace App\Http\Requests\Admin\Panx\Device;

use App\Http\Requests\ApiRequest;
use Illuminate\Foundation\Http\FormRequest;

/**
 * @property string device_name
 * @property string specification
 * @property string producer
 * @property string skin_detector_id
 * @property string $device_spec_id
 * @property string buyer
 * @property string sku
 * @property string purchase_at
 * @property mixed device_code
 */
class DeviceStoreRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'device_code'         => 'required|string|max:'.self::MAX_STRING,
            'device_name'         => 'required|string|max:'.self::MAX_STRING,
            'sku'                 => 'required|int|min:1|max:'.self::MAX_INT,
            'specification'       => 'required|string|max:'.self::MAX_STRING,
            'producer'            => 'required|string|max:'.self::MAX_STRING,
            'buyer'               => 'required|string|max:'.self::MAX_STRING,
            'purchase_at'         => 'required|date',
            'device_spec_id'      => 'required|int|min:1|max:'.self::MAX_INT,
        ];
    }

    /**
     * @return array
     */
//    public function messages()
//    {
//        return [
//            'uuid.*'             => ':attribute必须是字符串',
//            'device_name.*'      => ':attribute必须是字符串',
//            'sku.*'              => ':attribute必须是大于等于1的数值',
//            'specification.*'    => ':attribute必须是字符串',
//            'producer.*'         => ':attribute必须是字符串',
//            'buyer.*'            => ':attribute必须是字符串',
//            'purchase_at.*'      => ':attribute必须是日期',
//            'skin_detector_id.*' => ':attribute必须是数值',
//        ];
//    }
//
//    /**
//     * @return array
//     */
//    public function attributes()
//    {
//        return [
//            'uuid'             => '商品编号',
//            'device_name'      => '商品名称',
//            'sku'              => '采购数量',
//            'specification'    => '商品规格',
//            'producer'         => '生产商',
//            'buyer'            => '采购人',
//            'purchase_at'      => '采购日期',
//            'skin_detector_id' => '肤质检测仪的id',
//        ];
//    }
}
